package com.cy.pj.common.vo;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

@Data
@Accessors(chain = true)
public class PageObject<T> implements Serializable {
    private static final long serialVersionUID = 1536631092048817285L;
    private Integer pageCurrent = 1;  //当前页码值
    private Integer pageSize = 3;     //页面大小
    private Integer rowCount = 0;     //总行数(通过查询获得)
    private Integer pageCount = 0;    //总页数(通过计算获得)
    private List<T> records;

    public PageObject(){}

    public PageObject(Integer pageCurrent,
                      Integer pageSize,
                      Integer rowCount,
                      List<T> records) {
        this.pageCurrent = pageCurrent;
        this.pageSize = pageSize;
        this.rowCount = rowCount;
        this.pageCount = (rowCount -1) / pageSize + 1;
        this.records = records;
    }
}
